
*****FIRST***** install eststo if needed
findit eststo

**first 3 models with malaria as dependent variable
xtset countrynumber year
xtreg lmal lfor lnirr lnterrha agr sqcement cer year, fe 
eststo m1
xtreg lmal lfor lnirr lnterrha agr sqcement cer lnpop life rural young year, fe 
eststo m2
xtreg lmal lfor lnirr lnterrha agr sqcement cer lnpop life rural young sqhealth lngdp year,fe
eststo m3

**second model with gdp as dependent variable
xtreg lngdp labor laginv govt reg percoast year, fe
eststo m4
xtreg lngdp lmal mallab labor laginv govt malinv reg percoast year, fe
eststo m5

*making tables
esttab, star( + 0.10 * 0.05 ** 0.01 *** 0.001) se r2

*residuals and fitted values
predict yhat
predict uhat
graph twoway scatter uhat lmal
predict uhat2

** graphs
graph twoway scatter uhat lmal
graph twoway scatter uhat2 lngdp
histogram uhat, freq normal
histogram uhat2, freq normal
graph twoway scatter lmal lngdp
graph twoway scatter lmal lfor
graph twoway scatter lmal agr 
graph twoway scatter lmal lnirr 

**histograms
histogram malpop, freq normal
histogram lmal, freq normal
histogram lngdp, freq normal
histogram lnirr, freq normal
histogram lnpop, freq normal
histogram life, freq normal
histogram young, freq normal
histogram lnterrha, freq normal
histogram rural, freq normal
histogram sqcement, freq normal
histogram cer, freq normal
histogram sqhealth, freq normal
histogram labor, freq normal
histogram lnpop, freq normal
histogram govt, freq normal
histogram lfor, freq normal
histogram agr, freq normal
histogram lfor, freq normal
histogram labor, freq normal
histogram laginv, freq normal
histogram laginv, freq normal
histogram govt, freq normal
histogram percoast, freq normal
histogram reg, freq normal
histogram mallab, freq normal
histogram malinv, freq normal
histogram gdp, freq normal

*summary stats
summary stats
sum lmal lfor lnirr lnterrha agr sqcement cer lnpop life rural young sqhealth lngdp mallab labor laginv govt malinv reg percoast
sum lmal
sum lngdp
sum lfor
sum agr
sum lnirr
sum cer
sum lnterrha
sum young
sum labor
sum lnpop
sum sqhealth
sum rural
sum life
sum sqcement
sum govt
sum reg
sum percoast
sum mallab]
sum malinv
sum laginv
